home *** CD-ROM | disk | FTP | other *** search
- package java.lang;
-
- import [Ljava.lang.Object;;
- import java.io.InputStream;
- import java.io.ObjectStreamField;
- import java.io.Serializable;
- import java.lang.annotation.Annotation;
- import java.lang.ref.SoftReference;
- import java.lang.reflect.AnnotatedElement;
- import java.lang.reflect.Array;
- import java.lang.reflect.Constructor;
- import java.lang.reflect.Field;
- import java.lang.reflect.GenericArrayType;
- import java.lang.reflect.GenericDeclaration;
- import java.lang.reflect.InvocationTargetException;
- import java.lang.reflect.Method;
- import java.lang.reflect.Modifier;
- import java.lang.reflect.Type;
- import java.lang.reflect.TypeVariable;
- import java.net.URL;
- import java.security.AccessController;
- import java.security.CodeSource;
- import java.security.Permissions;
- import java.security.ProtectionDomain;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Map;
- import java.util.Set;
- import sun.misc.Unsafe;
- import sun.reflect.ConstantPool;
- import sun.reflect.Reflection;
- import sun.reflect.ReflectionFactory;
- import sun.reflect.annotation.AnnotationParser;
- import sun.reflect.annotation.AnnotationType;
- import sun.reflect.generics.factory.CoreReflectionFactory;
- import sun.reflect.generics.factory.GenericsFactory;
- import sun.reflect.generics.repository.ClassRepository;
- import sun.reflect.generics.repository.ConstructorRepository;
- import sun.reflect.generics.repository.MethodRepository;
- import sun.reflect.generics.scope.ClassScope;
- import sun.security.util.SecurityConstants;
-
- public final class Class<T> implements Serializable, GenericDeclaration, Type, AnnotatedElement {
- private static final int ANNOTATION = 8192;
- private static final int ENUM = 16384;
- private static final int SYNTHETIC = 4096;
- private transient volatile Constructor<T> cachedConstructor;
- private transient volatile Class newInstanceCallerCache;
- private transient String name;
- private static ProtectionDomain allPermDomain;
- private static boolean useCaches;
- private transient volatile SoftReference declaredFields;
- private transient volatile SoftReference publicFields;
- private transient volatile SoftReference declaredMethods;
- private transient volatile SoftReference publicMethods;
- private transient volatile SoftReference declaredConstructors;
- private transient volatile SoftReference publicConstructors;
- private transient volatile SoftReference declaredPublicFields;
- private transient volatile SoftReference declaredPublicMethods;
- private transient volatile int classRedefinedCount = 0;
- private transient volatile int lastRedefinedCount = 0;
- private transient ClassRepository genericInfo;
- private static final long serialVersionUID = 3206093459760846163L;
- private static final ObjectStreamField[] serialPersistentFields;
- private static ReflectionFactory reflectionFactory;
- private static boolean initted;
- private transient volatile T[] enumConstants = null;
- private transient volatile Map<String, T> enumConstantDirectory = null;
- private static Annotation[] EMPTY_ANNOTATIONS_ARRAY;
- private transient Map<Class, Annotation> annotations;
- private transient Map<Class, Annotation> declaredAnnotations;
- private AnnotationType annotationType;
-
- private static native void registerNatives();
-
- private Class() {
- }
-
- public String toString() {
- return (this.isInterface() ? "interface " : (this.isPrimitive() ? "" : "class ")) + this.getName();
- }
-
- public static Class<?> forName(String var0) throws ClassNotFoundException {
- return forName0(var0, true, ClassLoader.getCallerClassLoader());
- }
-
- public static Class<?> forName(String var0, boolean var1, ClassLoader var2) throws ClassNotFoundException {
- if (var2 == null) {
- SecurityManager var3 = System.getSecurityManager();
- if (var3 != null) {
- ClassLoader var4 = ClassLoader.getCallerClassLoader();
- if (var4 != null) {
- var3.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
- }
- }
- }
-
- return forName0(var0, var1, var2);
- }
-
- private static native Class forName0(String var0, boolean var1, ClassLoader var2) throws ClassNotFoundException;
-
- public T newInstance() throws InstantiationException, IllegalAccessException {
- if (System.getSecurityManager() != null) {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- }
-
- return (T)this.newInstance0();
- }
-
- private T newInstance0() throws InstantiationException, IllegalAccessException {
- if (this.cachedConstructor == null) {
- if (this == Class.class) {
- throw new IllegalAccessException("Can not call newInstance() on the Class for java.lang.Class");
- }
-
- try {
- Class[] var1 = new Class[0];
- Constructor var2 = this.getConstructor0(var1, 1);
- AccessController.doPrivileged(new 1(this, var2));
- this.cachedConstructor = var2;
- } catch (NoSuchMethodException var5) {
- throw new InstantiationException(this.getName());
- }
- }
-
- Constructor var6 = this.cachedConstructor;
- int var7 = var6.getModifiers();
- if (!Reflection.quickCheckMemberAccess(this, var7)) {
- Class var3 = Reflection.getCallerClass(3);
- if (this.newInstanceCallerCache != var3) {
- Reflection.ensureMemberAccess(var3, this, (Object)null, var7);
- this.newInstanceCallerCache = var3;
- }
- }
-
- try {
- return (T)var6.newInstance((Object[])null);
- } catch (InvocationTargetException var4) {
- Unsafe.getUnsafe().throwException(var4.getTargetException());
- return null;
- }
- }
-
- public native boolean isInstance(Object var1);
-
- public native boolean isAssignableFrom(Class<?> var1);
-
- public native boolean isInterface();
-
- public native boolean isArray();
-
- public native boolean isPrimitive();
-
- public boolean isAnnotation() {
- return (this.getModifiers() & 8192) != 0;
- }
-
- public boolean isSynthetic() {
- return (this.getModifiers() & 4096) != 0;
- }
-
- public String getName() {
- if (this.name == null) {
- this.name = this.getName0();
- }
-
- return this.name;
- }
-
- private native String getName0();
-
- public ClassLoader getClassLoader() {
- ClassLoader var1 = this.getClassLoader0();
- if (var1 == null) {
- return null;
- } else {
- SecurityManager var2 = System.getSecurityManager();
- if (var2 != null) {
- ClassLoader var3 = ClassLoader.getCallerClassLoader();
- if (var3 != null && var3 != var1 && !var1.isAncestor(var3)) {
- var2.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
- }
- }
-
- return var1;
- }
- }
-
- native ClassLoader getClassLoader0();
-
- public TypeVariable<Class<T>>[] getTypeParameters() {
- return this.getGenericSignature() != null ? (TypeVariable[])this.getGenericInfo().getTypeParameters() : (TypeVariable[])(new TypeVariable[0]);
- }
-
- public native Class<? super T> getSuperclass();
-
- public Type getGenericSuperclass() {
- if (this.getGenericSignature() != null) {
- return this.isInterface() ? null : this.getGenericInfo().getSuperclass();
- } else {
- return this.getSuperclass();
- }
- }
-
- public Package getPackage() {
- return Package.getPackage(this);
- }
-
- public native Class<?>[] getInterfaces();
-
- public Type[] getGenericInterfaces() {
- return (Type[])(this.getGenericSignature() != null ? this.getGenericInfo().getSuperInterfaces() : this.getInterfaces());
- }
-
- public native Class<?> getComponentType();
-
- public native int getModifiers();
-
- public native Object[] getSigners();
-
- native void setSigners(Object[] var1);
-
- public Method getEnclosingMethod() {
- EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
- if (var1 == null) {
- return null;
- } else if (!var1.isMethod()) {
- return null;
- } else {
- MethodRepository var2 = MethodRepository.make(var1.getDescriptor(), this.getFactory());
- Class var3 = toClass(var2.getReturnType());
- Type[] var4 = var2.getParameterTypes();
- Class[] var5 = new Class[var4.length];
-
- for(int var6 = 0; var6 < var5.length; ++var6) {
- var5[var6] = toClass(var4[var6]);
- }
-
- for(Method var9 : var1.getEnclosingClass().getDeclaredMethods()) {
- if (var9.getName().equals(var1.getName())) {
- Class[] var10 = var9.getParameterTypes();
- if (var10.length == var5.length) {
- boolean var11 = true;
-
- for(int var12 = 0; var12 < var10.length; ++var12) {
- if (!var10[var12].equals(var5[var12])) {
- var11 = false;
- break;
- }
- }
-
- if (var11 && var9.getReturnType().equals(var3)) {
- return var9;
- }
- }
- }
- }
-
- throw new InternalError("Enclosing method not found");
- }
- }
-
- private native Object[] getEnclosingMethod0();
-
- private EnclosingMethodInfo getEnclosingMethodInfo() {
- Object[] var1 = this.getEnclosingMethod0();
- return var1 == null ? null : new EnclosingMethodInfo(var1, (1)null);
- }
-
- private static Class toClass(Type var0) {
- return var0 instanceof GenericArrayType ? Array.newInstance(toClass(((GenericArrayType)var0).getGenericComponentType()), 0).getClass() : (Class)var0;
- }
-
- public Constructor<?> getEnclosingConstructor() {
- EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
- if (var1 == null) {
- return null;
- } else if (!var1.isConstructor()) {
- return null;
- } else {
- ConstructorRepository var2 = ConstructorRepository.make(var1.getDescriptor(), this.getFactory());
- Type[] var3 = var2.getParameterTypes();
- Class[] var4 = new Class[var3.length];
-
- for(int var5 = 0; var5 < var4.length; ++var5) {
- var4[var5] = toClass(var3[var5]);
- }
-
- for(Constructor var8 : var1.getEnclosingClass().getDeclaredConstructors()) {
- Class[] var9 = var8.getParameterTypes();
- if (var9.length == var4.length) {
- boolean var10 = true;
-
- for(int var11 = 0; var11 < var9.length; ++var11) {
- if (!var9[var11].equals(var4[var11])) {
- var10 = false;
- break;
- }
- }
-
- if (var10) {
- return var8;
- }
- }
- }
-
- throw new InternalError("Enclosing constructor not found");
- }
- }
-
- public native Class<?> getDeclaringClass();
-
- public Class<?> getEnclosingClass() {
- EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
- if (var1 == null) {
- return this.getDeclaringClass();
- } else {
- Class var2 = var1.getEnclosingClass();
- if (var2 != this && var2 != null) {
- return var2;
- } else {
- throw new InternalError("Malformed enclosing method information");
- }
- }
- }
-
- public String getSimpleName() {
- if (this.isArray()) {
- return this.getComponentType().getSimpleName() + "[]";
- } else {
- String var1 = this.getSimpleBinaryName();
- if (var1 == null) {
- var1 = this.getName();
- return var1.substring(var1.lastIndexOf(".") + 1);
- } else {
- int var2 = var1.length();
- if (var2 >= 1 && var1.charAt(0) == '$') {
- int var3;
- for(var3 = 1; var3 < var2 && isAsciiDigit(var1.charAt(var3)); ++var3) {
- }
-
- return var1.substring(var3);
- } else {
- throw new InternalError("Malformed class name");
- }
- }
- }
- }
-
- private static boolean isAsciiDigit(char var0) {
- return '0' <= var0 && var0 <= '9';
- }
-
- public String getCanonicalName() {
- if (this.isArray()) {
- String var3 = this.getComponentType().getCanonicalName();
- return var3 != null ? var3 + "[]" : null;
- } else if (this.isLocalOrAnonymousClass()) {
- return null;
- } else {
- Class var1 = this.getEnclosingClass();
- if (var1 == null) {
- return this.getName();
- } else {
- String var2 = var1.getCanonicalName();
- return var2 == null ? null : var2 + "." + this.getSimpleName();
- }
- }
- }
-
- public boolean isAnonymousClass() {
- return "".equals(this.getSimpleName());
- }
-
- public boolean isLocalClass() {
- return this.isLocalOrAnonymousClass() && !this.isAnonymousClass();
- }
-
- public boolean isMemberClass() {
- return this.getSimpleBinaryName() != null && !this.isLocalOrAnonymousClass();
- }
-
- private String getSimpleBinaryName() {
- Class var1 = this.getEnclosingClass();
- if (var1 == null) {
- return null;
- } else {
- try {
- return this.getName().substring(var1.getName().length());
- } catch (IndexOutOfBoundsException var3) {
- throw new InternalError("Malformed class name");
- }
- }
- }
-
- private boolean isLocalOrAnonymousClass() {
- return this.getEnclosingMethodInfo() != null;
- }
-
- public Class<?>[] getClasses() {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- Class[] var1 = (Class[])AccessController.doPrivileged(new 2(this));
- return var1;
- }
-
- public Field[] getFields() throws SecurityException {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- return copyFields(this.privateGetPublicFields((Set)null));
- }
-
- public Method[] getMethods() throws SecurityException {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- return copyMethods(this.privateGetPublicMethods());
- }
-
- public Constructor<?>[] getConstructors() throws SecurityException {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- return copyConstructors(this.privateGetDeclaredConstructors(true));
- }
-
- public Field getField(String var1) throws NoSuchFieldException, SecurityException {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- Field var2 = this.getField0(var1);
- if (var2 == null) {
- throw new NoSuchFieldException(var1);
- } else {
- return var2;
- }
- }
-
- public Method getMethod(String var1, Class<?>... var2) throws NoSuchMethodException, SecurityException {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- Method var3 = this.getMethod0(var1, var2);
- if (var3 == null) {
- throw new NoSuchMethodException(this.getName() + "." + var1 + argumentTypesToString(var2));
- } else {
- return var3;
- }
- }
-
- public Constructor<T> getConstructor(Class<?>... var1) throws NoSuchMethodException, SecurityException {
- this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
- return this.getConstructor0(var1, 0);
- }
-
- public Class<?>[] getDeclaredClasses() throws SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- return this.getDeclaredClasses0();
- }
-
- public Field[] getDeclaredFields() throws SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- return copyFields(this.privateGetDeclaredFields(false));
- }
-
- public Method[] getDeclaredMethods() throws SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- return copyMethods(this.privateGetDeclaredMethods(false));
- }
-
- public Constructor<?>[] getDeclaredConstructors() throws SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- return copyConstructors(this.privateGetDeclaredConstructors(false));
- }
-
- public Field getDeclaredField(String var1) throws NoSuchFieldException, SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- Field var2 = this.searchFields(this.privateGetDeclaredFields(false), var1);
- if (var2 == null) {
- throw new NoSuchFieldException(var1);
- } else {
- return var2;
- }
- }
-
- public Method getDeclaredMethod(String var1, Class<?>... var2) throws NoSuchMethodException, SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- Method var3 = searchMethods(this.privateGetDeclaredMethods(false), var1, var2);
- if (var3 == null) {
- throw new NoSuchMethodException(this.getName() + "." + var1 + argumentTypesToString(var2));
- } else {
- return var3;
- }
- }
-
- public Constructor<T> getDeclaredConstructor(Class<?>... var1) throws NoSuchMethodException, SecurityException {
- this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
- return this.getConstructor0(var1, 1);
- }
-
- public InputStream getResourceAsStream(String var1) {
- var1 = this.resolveName(var1);
- ClassLoader var2 = this.getClassLoader0();
- return var2 == null ? ClassLoader.getSystemResourceAsStream(var1) : var2.getResourceAsStream(var1);
- }
-
- public URL getResource(String var1) {
- var1 = this.resolveName(var1);
- ClassLoader var2 = this.getClassLoader0();
- return var2 == null ? ClassLoader.getSystemResource(var1) : var2.getResource(var1);
- }
-
- public ProtectionDomain getProtectionDomain() {
- SecurityManager var1 = System.getSecurityManager();
- if (var1 != null) {
- var1.checkPermission(SecurityConstants.GET_PD_PERMISSION);
- }
-
- ProtectionDomain var2 = this.getProtectionDomain0();
- if (var2 == null) {
- if (allPermDomain == null) {
- Permissions var3 = new Permissions();
- var3.add(SecurityConstants.ALL_PERMISSION);
- allPermDomain = new ProtectionDomain((CodeSource)null, var3);
- }
-
- var2 = allPermDomain;
- }
-
- return var2;
- }
-
- private native ProtectionDomain getProtectionDomain0();
-
- native void setProtectionDomain0(ProtectionDomain var1);
-
- static native Class getPrimitiveClass(String var0);
-
- private void checkMemberAccess(int var1, ClassLoader var2) {
- SecurityManager var3 = System.getSecurityManager();
- if (var3 != null) {
- var3.checkMemberAccess(this, var1);
- ClassLoader var4 = this.getClassLoader0();
- if (var2 != null && var2 != var4 && (var4 == null || !var4.isAncestor(var2))) {
- String var5 = this.getName();
- int var6 = var5.lastIndexOf(46);
- if (var6 != -1) {
- var3.checkPackageAccess(var5.substring(0, var6));
- }
- }
- }
-
- }
-
- private String resolveName(String var1) {
- if (var1 == null) {
- return var1;
- } else {
- if (!var1.startsWith("/")) {
- Class var2;
- for(var2 = this; var2.isArray(); var2 = var2.getComponentType()) {
- }
-
- String var3 = var2.getName();
- int var4 = var3.lastIndexOf(46);
- if (var4 != -1) {
- var1 = var3.substring(0, var4).replace('.', '/') + "/" + var1;
- }
- } else {
- var1 = var1.substring(1);
- }
-
- return var1;
- }
- }
-
- private void clearCachesOnClassRedefinition() {
- if (this.lastRedefinedCount != this.classRedefinedCount) {
- this.declaredFields = this.publicFields = this.declaredPublicFields = null;
- this.declaredMethods = this.publicMethods = this.declaredPublicMethods = null;
- this.declaredConstructors = this.publicConstructors = null;
- this.annotations = this.declaredAnnotations = null;
- this.lastRedefinedCount = this.classRedefinedCount;
- }
-
- }
-
- private native String getGenericSignature();
-
- private GenericsFactory getFactory() {
- return CoreReflectionFactory.make(this, ClassScope.make(this));
- }
-
- private ClassRepository getGenericInfo() {
- if (this.genericInfo == null) {
- this.genericInfo = ClassRepository.make(this.getGenericSignature(), this.getFactory());
- }
-
- return this.genericInfo;
- }
-
- private native byte[] getRawAnnotations();
-
- native ConstantPool getConstantPool();
-
- private Field[] privateGetDeclaredFields(boolean var1) {
- checkInitted();
- Field[] var2 = null;
- if (useCaches) {
- this.clearCachesOnClassRedefinition();
- if (var1) {
- if (this.declaredPublicFields != null) {
- var2 = (Field[])this.declaredPublicFields.get();
- }
- } else if (this.declaredFields != null) {
- var2 = (Field[])this.declaredFields.get();
- }
-
- if (var2 != null) {
- return var2;
- }
- }
-
- var2 = Reflection.filterFields(this, this.getDeclaredFields0(var1));
- if (useCaches) {
- if (var1) {
- this.declaredPublicFields = new SoftReference(var2);
- } else {
- this.declaredFields = new SoftReference(var2);
- }
- }
-
- return var2;
- }
-
- private Field[] privateGetPublicFields(Set var1) {
- checkInitted();
- Field[] var2 = null;
- if (useCaches) {
- this.clearCachesOnClassRedefinition();
- if (this.publicFields != null) {
- var2 = (Field[])this.publicFields.get();
- }
-
- if (var2 != null) {
- return var2;
- }
- }
-
- ArrayList var3 = new ArrayList();
- if (var1 == null) {
- var1 = new HashSet();
- }
-
- Field[] var4 = this.privateGetDeclaredFields(true);
- addAll(var3, var4);
- Class[] var5 = this.getInterfaces();
-
- for(int var6 = 0; var6 < var5.length; ++var6) {
- Class var7 = var5[var6];
- if (!((Set)var1).contains(var7)) {
- ((Set)var1).add(var7);
- addAll(var3, var7.privateGetPublicFields((Set)var1));
- }
- }
-
- if (!this.isInterface()) {
- Class var9 = this.getSuperclass();
- if (var9 != null) {
- addAll(var3, var9.privateGetPublicFields((Set)var1));
- }
- }
-
- var2 = new Field[var3.size()];
- var3.toArray(var2);
- if (useCaches) {
- this.publicFields = new SoftReference(var2);
- }
-
- return var2;
- }
-
- private static void addAll(Collection var0, Field[] var1) {
- for(int var2 = 0; var2 < var1.length; ++var2) {
- var0.add(var1[var2]);
- }
-
- }
-
- private Constructor[] privateGetDeclaredConstructors(boolean var1) {
- checkInitted();
- Constructor[] var2 = null;
- if (useCaches) {
- this.clearCachesOnClassRedefinition();
- if (var1) {
- if (this.publicConstructors != null) {
- var2 = (Constructor[])this.publicConstructors.get();
- }
- } else if (this.declaredConstructors != null) {
- var2 = (Constructor[])this.declaredConstructors.get();
- }
-
- if (var2 != null) {
- return var2;
- }
- }
-
- if (this.isInterface()) {
- var2 = new Constructor[0];
- } else {
- var2 = this.getDeclaredConstructors0(var1);
- }
-
- if (useCaches) {
- if (var1) {
- this.publicConstructors = new SoftReference(var2);
- } else {
- this.declaredConstructors = new SoftReference(var2);
- }
- }
-
- return var2;
- }
-
- private Method[] privateGetDeclaredMethods(boolean var1) {
- checkInitted();
- Method[] var2 = null;
- if (useCaches) {
- this.clearCachesOnClassRedefinition();
- if (var1) {
- if (this.declaredPublicMethods != null) {
- var2 = (Method[])this.declaredPublicMethods.get();
- }
- } else if (this.declaredMethods != null) {
- var2 = (Method[])this.declaredMethods.get();
- }
-
- if (var2 != null) {
- return var2;
- }
- }
-
- var2 = this.getDeclaredMethods0(var1);
- if (useCaches) {
- if (var1) {
- this.declaredPublicMethods = new SoftReference(var2);
- } else {
- this.declaredMethods = new SoftReference(var2);
- }
- }
-
- return var2;
- }
-
- private Method[] privateGetPublicMethods() {
- checkInitted();
- Method[] var1 = null;
- if (useCaches) {
- this.clearCachesOnClassRedefinition();
- if (this.publicMethods != null) {
- var1 = (Method[])this.publicMethods.get();
- }
-
- if (var1 != null) {
- return var1;
- }
- }
-
- MethodArray var2 = new MethodArray();
- Method[] var3 = this.privateGetDeclaredMethods(true);
- var2.addAll(var3);
- MethodArray var10 = new MethodArray();
- Class[] var4 = this.getInterfaces();
-
- for(int var5 = 0; var5 < var4.length; ++var5) {
- var10.addAll(var4[var5].privateGetPublicMethods());
- }
-
- if (!this.isInterface()) {
- Class var11 = this.getSuperclass();
- if (var11 != null) {
- MethodArray var6 = new MethodArray();
- var6.addAll(var11.privateGetPublicMethods());
-
- for(int var7 = 0; var7 < var6.length(); ++var7) {
- Method var8 = var6.get(var7);
- if (var8 != null && !Modifier.isAbstract(var8.getModifiers())) {
- var10.removeByNameAndSignature(var8);
- }
- }
-
- var6.addAll(var10);
- var10 = var6;
- }
- }
-
- for(int var12 = 0; var12 < var2.length(); ++var12) {
- Method var13 = var2.get(var12);
- var10.removeByNameAndSignature(var13);
- }
-
- var2.addAllIfNotPresent(var10);
- var2.compactAndTrim();
- var1 = var2.getArray();
- if (useCaches) {
- this.publicMethods = new SoftReference(var1);
- }
-
- return var1;
- }
-
- private Field searchFields(Field[] var1, String var2) {
- String var3 = var2.intern();
-
- for(int var4 = 0; var4 < var1.length; ++var4) {
- if (var1[var4].getName() == var3) {
- return getReflectionFactory().copyField(var1[var4]);
- }
- }
-
- return null;
- }
-
- private Field getField0(String var1) throws NoSuchFieldException {
- Object var2 = null;
- Field var6;
- if ((var6 = this.searchFields(this.privateGetDeclaredFields(true), var1)) != null) {
- return var6;
- } else {
- Class[] var3 = this.getInterfaces();
-
- for(int var4 = 0; var4 < var3.length; ++var4) {
- Class var5 = var3[var4];
- if ((var6 = var5.getField0(var1)) != null) {
- return var6;
- }
- }
-
- if (!this.isInterface()) {
- Class var9 = this.getSuperclass();
- if (var9 != null && (var6 = var9.getField0(var1)) != null) {
- return var6;
- }
- }
-
- return null;
- }
- }
-
- private static Method searchMethods(Method[] var0, String var1, Class[] var2) {
- Method var3 = null;
- String var4 = var1.intern();
-
- for(int var5 = 0; var5 < var0.length; ++var5) {
- Method var6 = var0[var5];
- if (var6.getName() == var4 && arrayContentsEq(var2, var6.getParameterTypes()) && (var3 == null || var3.getReturnType().isAssignableFrom(var6.getReturnType()))) {
- var3 = var6;
- }
- }
-
- return var3 == null ? var3 : getReflectionFactory().copyMethod(var3);
- }
-
- private Method getMethod0(String var1, Class[] var2) {
- Object var3 = null;
- Method var7;
- if ((var7 = searchMethods(this.privateGetDeclaredMethods(true), var1, var2)) != null) {
- return var7;
- } else {
- if (!this.isInterface()) {
- Class var4 = this.getSuperclass();
- if (var4 != null && (var7 = var4.getMethod0(var1, var2)) != null) {
- return var7;
- }
- }
-
- Class[] var10 = this.getInterfaces();
-
- for(int var5 = 0; var5 < var10.length; ++var5) {
- Class var6 = var10[var5];
- if ((var7 = var6.getMethod0(var1, var2)) != null) {
- return var7;
- }
- }
-
- return null;
- }
- }
-
- private Constructor<T> getConstructor0(Class[] var1, int var2) throws NoSuchMethodException {
- Constructor[] var3 = this.privateGetDeclaredConstructors(var2 == 0);
-
- for(int var4 = 0; var4 < var3.length; ++var4) {
- if (arrayContentsEq(var1, var3[var4].getParameterTypes())) {
- return getReflectionFactory().copyConstructor(var3[var4]);
- }
- }
-
- throw new NoSuchMethodException(this.getName() + ".<init>" + argumentTypesToString(var1));
- }
-
- private static boolean arrayContentsEq(Object[] var0, Object[] var1) {
- if (var0 != null) {
- if (var1 == null) {
- return var0.length == 0;
- } else if (var0.length != var1.length) {
- return false;
- } else {
- for(int var2 = 0; var2 < var0.length; ++var2) {
- if (var0[var2] != var1[var2]) {
- return false;
- }
- }
-
- return true;
- }
- } else {
- return var1 == null || var1.length == 0;
- }
- }
-
- private static Field[] copyFields(Field[] var0) {
- Field[] var1 = new Field[var0.length];
- ReflectionFactory var2 = getReflectionFactory();
-
- for(int var3 = 0; var3 < var0.length; ++var3) {
- var1[var3] = var2.copyField(var0[var3]);
- }
-
- return var1;
- }
-
- private static Method[] copyMethods(Method[] var0) {
- Method[] var1 = new Method[var0.length];
- ReflectionFactory var2 = getReflectionFactory();
-
- for(int var3 = 0; var3 < var0.length; ++var3) {
- var1[var3] = var2.copyMethod(var0[var3]);
- }
-
- return var1;
- }
-
- private static Constructor[] copyConstructors(Constructor[] var0) {
- Constructor[] var1 = new Constructor[var0.length];
- ReflectionFactory var2 = getReflectionFactory();
-
- for(int var3 = 0; var3 < var0.length; ++var3) {
- var1[var3] = var2.copyConstructor(var0[var3]);
- }
-
- return var1;
- }
-
- private native Field[] getDeclaredFields0(boolean var1);
-
- private native Method[] getDeclaredMethods0(boolean var1);
-
- private native Constructor[] getDeclaredConstructors0(boolean var1);
-
- private native Class[] getDeclaredClasses0();
-
- private static String argumentTypesToString(Class[] var0) {
- StringBuilder var1 = new StringBuilder();
- var1.append("(");
- if (var0 != null) {
- for(int var2 = 0; var2 < var0.length; ++var2) {
- if (var2 > 0) {
- var1.append(", ");
- }
-
- Class var3 = var0[var2];
- var1.append(var3 == null ? "null" : var3.getName());
- }
- }
-
- var1.append(")");
- return var1.toString();
- }
-
- public boolean desiredAssertionStatus() {
- ClassLoader var1 = this.getClassLoader();
- if (var1 == null) {
- return desiredAssertionStatus0(this);
- } else {
- synchronized(var1) {
- return var1.classAssertionStatus == null ? desiredAssertionStatus0(this) : var1.desiredAssertionStatus(this.getName());
- }
- }
- }
-
- private static native boolean desiredAssertionStatus0(Class var0);
-
- public boolean isEnum() {
- return (this.getModifiers() & 16384) != 0 && this.getSuperclass() == Enum.class;
- }
-
- private static ReflectionFactory getReflectionFactory() {
- if (reflectionFactory == null) {
- reflectionFactory = (ReflectionFactory)AccessController.doPrivileged(new ReflectionFactory.GetReflectionFactoryAction());
- }
-
- return reflectionFactory;
- }
-
- private static void checkInitted() {
- if (!initted) {
- AccessController.doPrivileged(new 3());
- }
- }
-
- public T[] getEnumConstants() {
- Object[] var1 = this.getEnumConstantsShared();
- return (T[])(var1 != null ? (Object[])((Object;)var1).clone() : null);
- }
-
- T[] getEnumConstantsShared() {
- if (this.enumConstants == null) {
- if (!this.isEnum()) {
- return null;
- }
-
- try {
- Method var1 = this.getMethod("values");
- AccessController.doPrivileged(new 4(this, var1));
- this.enumConstants = (T[])((Object[])var1.invoke((Object)null));
- } catch (InvocationTargetException var2) {
- return null;
- } catch (NoSuchMethodException var3) {
- return null;
- } catch (IllegalAccessException var4) {
- return null;
- }
- }
-
- return this.enumConstants;
- }
-
- Map<String, T> enumConstantDirectory() {
- if (this.enumConstantDirectory == null) {
- Object[] var1 = this.getEnumConstantsShared();
- if (var1 == null) {
- throw new IllegalArgumentException(this.getName() + " is not an enum type");
- }
-
- HashMap var2 = new HashMap(2 * var1.length);
-
- for(Object var6 : var1) {
- var2.put(((Enum)var6).name(), var6);
- }
-
- this.enumConstantDirectory = var2;
- }
-
- return this.enumConstantDirectory;
- }
-
- public T cast(Object var1) {
- if (var1 != null && !this.isInstance(var1)) {
- throw new ClassCastException();
- } else {
- return (T)var1;
- }
- }
-
- public <U> Class<? extends U> asSubclass(Class<U> var1) {
- if (var1.isAssignableFrom(this)) {
- return this;
- } else {
- throw new ClassCastException(this.toString());
- }
- }
-
- public <A extends Annotation> A getAnnotation(Class<A> var1) {
- if (var1 == null) {
- throw new NullPointerException();
- } else {
- this.initAnnotationsIfNecessary();
- return (A)(this.annotations.get(var1));
- }
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> var1) {
- if (var1 == null) {
- throw new NullPointerException();
- } else {
- return this.getAnnotation(var1) != null;
- }
- }
-
- public Annotation[] getAnnotations() {
- this.initAnnotationsIfNecessary();
- return (Annotation[])this.annotations.values().toArray(EMPTY_ANNOTATIONS_ARRAY);
- }
-
- public Annotation[] getDeclaredAnnotations() {
- this.initAnnotationsIfNecessary();
- return (Annotation[])this.declaredAnnotations.values().toArray(EMPTY_ANNOTATIONS_ARRAY);
- }
-
- private synchronized void initAnnotationsIfNecessary() {
- this.clearCachesOnClassRedefinition();
- if (this.annotations == null) {
- this.declaredAnnotations = AnnotationParser.parseAnnotations(this.getRawAnnotations(), this.getConstantPool(), this);
- Class var1 = this.getSuperclass();
- if (var1 == null) {
- this.annotations = this.declaredAnnotations;
- } else {
- this.annotations = new HashMap();
- var1.initAnnotationsIfNecessary();
-
- for(Map.Entry var3 : var1.annotations.entrySet()) {
- Class var4 = (Class)var3.getKey();
- if (AnnotationType.getInstance(var4).isInherited()) {
- this.annotations.put(var4, var3.getValue());
- }
- }
-
- this.annotations.putAll(this.declaredAnnotations);
- }
-
- }
- }
-
- void setAnnotationType(AnnotationType var1) {
- this.annotationType = var1;
- }
-
- AnnotationType getAnnotationType() {
- return this.annotationType;
- }
-
- // $FF: synthetic method
- static boolean access$100(Object[] var0, Object[] var1) {
- return arrayContentsEq(var0, var1);
- }
-
- // $FF: synthetic method
- static boolean access$202(boolean var0) {
- useCaches = var0;
- return var0;
- }
-
- // $FF: synthetic method
- static boolean access$302(boolean var0) {
- initted = var0;
- return var0;
- }
-
- static {
- registerNatives();
- useCaches = true;
- serialPersistentFields = new ObjectStreamField[0];
- initted = false;
- EMPTY_ANNOTATIONS_ARRAY = new Annotation[0];
- }
- }
-